package com.o2o.utils;

import com.google.code.kaptcha.Constants;

import javax.servlet.http.HttpServletRequest;

/**
 * package_name:com.o2o.utils
 * Author:徐亚远
 * Date:2019/12/1 17:18
 * 项目名:o2o
 * Desription:
 **/
public class CodeUtil {
    public static boolean checkVerifyCode(HttpServletRequest request){
         String verifyCodeExcepted = (String)request.getSession().getAttribute(
                Constants.KAPTCHA_SESSION_KEY);
      String  verifyCodeActual = HttpServletRequestUtil.getString(request,"verifyCodeActual" );
     if (verifyCodeActual ==null || !verifyCodeActual.equals(verifyCodeExcepted)){
          return false;
     }
     return true;
    }
}
